<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.2.0">


  <link rel="apple-touch-icon" sizes="180x180" href="https://www.wulihub.com.cn/gc/Wez0VG/images/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="https://www.wulihub.com.cn/gc/Wez0VG/images/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="https://www.wulihub.com.cn/gc/Wez0VG/images/favicon-16x16.png">
  <link rel="mask-icon" href="https://www.wulihub.com.cn/gc/Wez0VG/images/logo.svg" color="#222">

<link rel="stylesheet" href="https://www.wulihub.com.cn/gc/Wez0VG/css/main.css">



<link rel="stylesheet" href="https://npm.elemecdn.com/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://npm.elemecdn.com/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"nobige.cn","root":"/","images":"https://www.wulihub.com.cn/gc/Wez0VG/images","scheme":"Gemini","darkmode":false,"version":"8.12.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"Searching...","empty":"We didn't find any results for the search: ${query}","hits_time":"${hits} results found in ${time} ms","hits":"${hits} results found"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/config.js"></script>

    <meta name="description" content="报错1234567An error occurred.Sorry, the page you are looking for is currently unavailable.Please try again later.If you are the system administrator of this resource then you should checkthe error log">
<meta property="og:type" content="article">
<meta property="og:title" content="Nginx报An error occurred">
<meta property="og:url" content="https://nobige.cn/post/20230718-Nginx_bao_An_error_occurred/index.html">
<meta property="og:site_name" content="NoBige-JackCh3n">
<meta property="og:description" content="报错1234567An error occurred.Sorry, the page you are looking for is currently unavailable.Please try again later.If you are the system administrator of this resource then you should checkthe error log">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20230718-Nginx_bao_An_error_occurred/jaredd-craig-JIbfAlOIFw4-unsplash.jpg">
<meta property="og:image" content="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20230718-Nginx_bao_An_error_occurred/fuckqq.2023.07.18.10.11.00.png">
<meta property="og:image" content="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20230718-Nginx_bao_An_error_occurred/fuckqq.2023.07.18.10.14.52.png">
<meta property="article:published_time" content="2023-07-18T02:00:14.000Z">
<meta property="article:modified_time" content="2024-11-07T02:59:06.330Z">
<meta property="article:author" content="JackCh3n">
<meta property="article:tag" content="nginx">
<meta property="article:tag" content="报错">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20230718-Nginx_bao_An_error_occurred/jaredd-craig-JIbfAlOIFw4-unsplash.jpg">


<link rel="canonical" href="https://nobige.cn/post/20230718-Nginx_bao_An_error_occurred/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"en","comments":true,"permalink":"https://nobige.cn/post/20230718-Nginx_bao_An_error_occurred/","path":"post/20230718-Nginx_bao_An_error_occurred/","title":"Nginx报An error occurred"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Nginx报An error occurred | NoBige-JackCh3n</title>
  
  <script class="next-config" data-name="google_analytics" type="application/json">{"tracking_id":"UA-122817633-1","only_pageview":true}</script>
  <script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/analytics/google-analytics.js"></script>

  <script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/analytics/baidu-analytics.js"></script>
  <script async src="https://hm.baidu.com/hm.js?96741f92c07d010c0ddd1d02197893e2"></script>




  <noscript>
    <link rel="stylesheet" href="https://www.wulihub.com.cn/gc/Wez0VG/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">NoBige-JackCh3n</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">copy to my blog</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="home fa-fw"></i>Home</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="user fa-fw"></i>About</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="tags fa-fw"></i>Tags</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="th fa-fw"></i>Categories</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="archive fa-fw"></i>Archives</a></li><li class="menu-item menu-item-sitemap"><a href="/sitemap.xml" rel="section"><i class="sitemap fa-fw"></i>Sitemap</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>Search
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="Searching..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8A%A5%E9%94%99"><span class="nav-number">1.</span> <span class="nav-text">报错</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%B5%B7%E5%9B%A0"><span class="nav-number">2.</span> <span class="nav-text">起因</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8E%92%E6%9F%A5"><span class="nav-number">3.</span> <span class="nav-text">排查</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Chat-GPT"><span class="nav-number">4.</span> <span class="nav-text">Chat-GPT</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%A7%A3%E5%86%B3"><span class="nav-number">5.</span> <span class="nav-text">解决</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%BF%81%E7%A7%BB"><span class="nav-number">6.</span> <span class="nav-text">迁移</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%BB%93%E8%AE%BA"><span class="nav-number">7.</span> <span class="nav-text">结论</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%8F%82%E8%80%83"><span class="nav-number">8.</span> <span class="nav-text">参考</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="JackCh3n"
      src="https://www.wulihub.com.cn/gc/Wez0VG/images/avatar.png">
  <p class="site-author-name" itemprop="name">JackCh3n</p>
  <div class="site-description" itemprop="description">Record the pit filling process with words</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">146</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">279</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/jackch3n" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;jackch3n" rel="noopener" target="_blank"><i class="github fa-fw"></i>GitHub</a>
      </span>
  </div>


  <div class="links-of-blogroll site-overview-item animated">
    <div class="links-of-blogroll-title"><i class="fa fa-globe fa-fw"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://vercel.com/?f=nobige" title="https:&#x2F;&#x2F;vercel.com?f&#x3D;nobige" rel="noopener" target="_blank">vercel</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://www.jsdelivr.com/?f=nobige" title="https:&#x2F;&#x2F;www.jsdelivr.com?f&#x3D;nobige" rel="noopener" target="_blank">jsdelivr</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://www.upyun.com/?f=nobige" title="https:&#x2F;&#x2F;www.upyun.com?f&#x3D;nobige" rel="noopener" target="_blank">upyun</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://coding.net/?f=nobige" title="https:&#x2F;&#x2F;coding.net?f&#x3D;nobige" rel="noopener" target="_blank">coding</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://unsplash.com/?f=nobige" title="https:&#x2F;&#x2F;unsplash.com?f&#x3D;nobige" rel="noopener" target="_blank">unsplash</a>
        </li>
    </ul>
  </div>

        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="Back to top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="en">
    <link itemprop="mainEntityOfPage" href="https://nobige.cn/post/20230718-Nginx_bao_An_error_occurred/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://www.wulihub.com.cn/gc/Wez0VG/images/avatar.png">
      <meta itemprop="name" content="JackCh3n">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="NoBige-JackCh3n">
      <meta itemprop="description" content="Record the pit filling process with words">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="Nginx报An error occurred | NoBige-JackCh3n">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Nginx报An error occurred
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">Posted on</span>

      <time title="Created: 2023-07-18 10:00:14" itemprop="dateCreated datePublished" datetime="2023-07-18T10:00:14+08:00">2023-07-18</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">Edited on</span>
      <time title="Modified: 2024-11-07 10:59:06" itemprop="dateModified" datetime="2024-11-07T10:59:06+08:00">2024-11-07</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">In</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E9%97%AE%E9%A2%98/" itemprop="url" rel="index"><span itemprop="name">问题</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="Views" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">Views: </span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p><img src="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20230718-Nginx_bao_An_error_occurred/jaredd-craig-JIbfAlOIFw4-unsplash.jpg" alt="jaredd-craig-JIbfAlOIFw4-unsplash"></p>
<h2 id="报错"><a href="#报错" class="headerlink" title="报错"></a>报错</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">An error occurred.</span><br><span class="line">Sorry, the page you are looking for is currently unavailable.</span><br><span class="line">Please try again later.</span><br><span class="line"></span><br><span class="line">If you are the system administrator of this resource then you should checkthe error log for details.</span><br><span class="line"></span><br><span class="line">Faithfully yours, nginx.</span><br></pre></td></tr></table></figure>

<p><img src="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20230718-Nginx_bao_An_error_occurred/fuckqq.2023.07.18.10.11.00.png" alt="An error occurred"></p>
<h2 id="起因"><a href="#起因" class="headerlink" title="起因"></a>起因</h2><blockquote>
<p>早上同事突然说是某某接口突然挂掉了，巴拉巴拉，然后亲自尝试了一下接口又是正常的，但人家又给出了对应的报错页面，还是得排查一下。</p>
</blockquote>
<h2 id="排查"><a href="#排查" class="headerlink" title="排查"></a>排查</h2><ol>
<li>bing搜索“An error occurred”相关，大部分都是没有啥用的，说是配置文件或者是重启啥的，不符合我的情况。我这配置文件正常，Nginx代理的其他接口也是正常的。</li>
<li>排查昨天添加的其他接口，将其注释——无效</li>
<li>找到一个说是接口限制，理论上不现实</li>
<li>尝试问Chat-GPT,给出以下一大堆建议</li>
</ol>
<h2 id="Chat-GPT"><a href="#Chat-GPT" class="headerlink" title="Chat-GPT"></a>Chat-GPT</h2><p>如果Nginx出现了”An error occurred”错误，这可能是由于多种原因引起的。为了解决此问题，你可以采取以下步骤进行排查和修复：</p>
<ol>
<li>检查错误日志：错误日志通常位于Nginx配置文件中指定的<code>error_log</code>路径下。打开该日志文件，查找与”An error occurred”相关的错误消息或异常信息。这将提供有关发生错误的详细上下文和提示。</li>
<li>检查配置文件：确保Nginx的配置文件（通常是<code>nginx.conf</code>）没有语法错误或配置错误。使用Nginx的配置检查工具（例如<code>nginx -t</code>）验证配置文件的正确性，并修复任何报告的问题。</li>
<li>查看服务状态：检查Nginx服务是否正在运行，并且没有出现任何异常。可以使用命令<code>systemctl status nginx</code>（适用于Systemd）或<code>service nginx status</code>（适用于SysV）来查看Nginx服务的状态。</li>
<li>重新启动Nginx服务：如果Nginx服务正在运行，但出现了错误，请尝试重新启动服务以清除任何临时问题。使用命令<code>systemctl restart nginx</code>（适用于Systemd）或<code>service nginx restart</code>（适用于SysV）来重启Nginx服务。</li>
<li>检查端口占用：确保Nginx所侦听的端口没有被其他进程占用。使用命令<code>netstat -tlnp</code>（Linux）或<code>lsof -i :端口号</code>来查找特定端口上的进程，如果发现冲突，可以修改Nginx配置文件中的端口号。</li>
<li>检查防火墙设置：确保防火墙允许对Nginx所监听的端口进行流量传输。根据你的操作系统和防火墙软件，配置相应的规则或例外，以允许端口访问。</li>
<li>检查资源限制：确保服务器上的资源限制（如文件描述符限制、内存限制等）不会导致Nginx出现错误。可以通过适当调整操作系统的参数或Nginx的配置参数来解决此类问题。</li>
</ol>
<p>如果上述步骤无法解决问题，建议参考Nginx的官方文档、论坛或社区资源，以获取更具体的帮助和支持。</p>
<h2 id="解决"><a href="#解决" class="headerlink" title="解决"></a>解决</h2><ul>
<li>其中错误日志这个很关键，试着去找日志 <code>/etc/nginx/logs/error.log</code> 再目录下发现<code>access.log</code>日志有点过大52g，都把硬盘占满了，问题应该就是这个了。</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 停止Nignx 并删除日志</span></span><br><span class="line">nginx -s quit &amp; <span class="built_in">rm</span> access.log</span><br><span class="line"><span class="comment"># 启动nginx</span></span><br><span class="line">nginx</span><br></pre></td></tr></table></figure>

<p>再次尝试调用接口，接口调用正常，成功解决问题</p>
<p>查看了下 <code>error.log</code> 发现谜底早已经给出来了。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">2023/07/15 10:17:19 [alert] 17785#0: *152476480 write() to &quot;/etc/nginx/logs/access.log&quot; was incomplete: 8 of 117 while logging request, client: 10.25.47.10, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;10.192.15.54:8088&quot;</span><br><span class="line">2023/07/15 10:18:19 [alert] 17785#0: *152477287 write() to &quot;/etc/nginx/logs/access.log&quot; failed (28: No space left on device) while logging request, client: 10.25.47.10, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;10.192.15.54:8088&quot;</span><br><span class="line">2023/07/15 10:19:19 [alert] 17785#0: *152477352 write() to &quot;/etc/nginx/logs/access.log&quot; failed (28: No space left on device) while logging request, client: 10.25.47.10, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;10.192.15.54:8088&quot;</span><br></pre></td></tr></table></figure>

<p><img src="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20230718-Nginx_bao_An_error_occurred/fuckqq.2023.07.18.10.14.52.png" alt="error.log"></p>
<p>简单的说是在记录请求时，尝试将日志写入<code>/etc/nginx/logs/access.log</code>文件时发生了一个不完整的写操作，可能是磁盘空间不足、文件权限问题、日志文件被其他进程锁定、存储介质错误、Nginx配置错误</p>
<h2 id="迁移"><a href="#迁移" class="headerlink" title="迁移"></a>迁移</h2><p>既然系统盘没啥空间，那就迁移到其他盘里面去</p>
<p>1 、Nginx改配置文件，使其日志文件放到其他盘中</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">vi /etc/nginx/nginx.conf</span><br><span class="line">http &#123;</span><br><span class="line">    include       mime.types;</span><br><span class="line">    default_type  application/octet-stream;</span><br><span class="line"></span><br><span class="line">    log_format  main  <span class="string">&#x27;$remote_addr - $remote_user [$time_local] &quot;$request&quot; &#x27;</span></span><br><span class="line">                      <span class="string">&#x27;$status $body_bytes_sent &quot;$http_referer&quot; &#x27;</span></span><br><span class="line">                      <span class="string">&#x27;&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;&#x27;</span>;</span><br><span class="line"></span><br><span class="line">    access_log  /data/tencentCloud/data/logs/nginx/access.log;</span><br><span class="line">    error_log /data/tencentCloud/data/logs/nginx/error.log;</span><br><span class="line">&#125;</span><br><span class="line"><span class="built_in">chmod</span> 0777 /data/tencentCloud/data/logs/nginx/</span><br><span class="line">nginx -s reload</span><br></pre></td></tr></table></figure>

<p>2、创建目录软连接，实现文件放到其他盘中的效果</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">nginx -s quit</span><br><span class="line"><span class="built_in">mv</span> /etc/nginx/logs /etc/nginx/logsOld</span><br><span class="line"><span class="built_in">ln</span> -s /etc/nginx/logs /data/tencentCloud/data/logs/nginx</span><br><span class="line"><span class="built_in">ln</span> -s [源文件或源目录] [目标文件或者目标目录]  </span><br><span class="line"><span class="comment">#删除软链接与删除普通文件夹一样, 通过 rm -rf 命令实现.</span></span><br><span class="line"><span class="built_in">rm</span> -rf /etc/nginx/logs</span><br></pre></td></tr></table></figure>



<h2 id="结论"><a href="#结论" class="headerlink" title="结论"></a>结论</h2><ul>
<li>日志要定期删除</li>
<li>排查保存步骤可以参考Chat-GPT提供的7步走来排查</li>
</ul>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><ul>
<li><a target="_blank" rel="noopener" href="https://unsplash.com/photos/a-lone-person-standing-in-the-middle-of-a-foggy-field-JIbfAlOIFw4">https://unsplash.com/photos/a-lone-person-standing-in-the-middle-of-a-foggy-field-JIbfAlOIFw4</a></li>
<li><a target="_blank" rel="noopener" href="https://my.oschina.net/yehun/blog/871106">nginx 报 A error occurred 错误的解决过程</a></li>
<li><a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_55299423/article/details/118614603">nginx的An error occurred 一个错误发生！！！</a></li>
<li><a target="_blank" rel="noopener" href="https://blog.csdn.net/z1427094386/article/details/120260364">liunx开启Nginx失败, 出现 An error occurred</a></li>
<li><a target="_blank" rel="noopener" href="https://www.cnblogs.com/willwuss/p/13696573.html">Linux 目录软链接 </a></li>
</ul>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/nginx/" rel="tag"># nginx</a>
              <a href="/tags/%E6%8A%A5%E9%94%99/" rel="tag"># 报错</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/20220919-Java_tiao_zheng_ya_suo_tu_pian/" rel="prev" title="Java调整压缩图片">
                  <i class="fa fa-chevron-left"></i> Java调整压缩图片
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/20230720-Hutool_HttpRequest_POST_GET_bian_ma_zhuan_ma_wen_ti/" rel="next" title="Hutool_HttpRequest_POST_GET编码转码问题">
                  Hutool_HttpRequest_POST_GET编码转码问题 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    
  <div class="comments" id="disqus_thread">
    <noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript>
  </div>
  
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">JackCh3n</span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="Total Visitors">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="Total Views">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a>
  </div>
    <br/>Powerful CDN service provided by 
  <a target="_blank" rel="noopener" href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" style="border:none"><img src="https://www.wulihub.com.cn/gc/Wez0VG/images/upyun_logo.png" height="66" style="display: list-item;" alt="upyun"></a> 
  <a target="_blank" rel="noopener" href="https://www.jsdelivr.com" style="border:none"><img src="https://www.wulihub.com.cn/gc/Wez0VG/images/jsdelivr_logo.svg" height="50" style="display: list-item;" alt="JsDelivr"></a>
  <p>
  <br/><a target="_blank" rel="noopener" href="https://pages.github.com/?f=nobige">Github Pages</a>&nbsp;&nbsp;<a target="_blank" rel="noopener" href="https://vercel.com/?f=nobige">Vercel</a>&nbsp;&nbsp;<a target="_blank" rel="noopener" href="https://www.netlify.com/?f=nobige">Netlify</a>&nbsp;&nbsp;<a target="_blank" rel="noopener" href="https://coding.net/?f=nobige">coding</a>&nbsp;&nbsp;provides static publishing
  </p>

    </div>
  </footer>

  
  <script src="https://npm.elemecdn.com/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="https://www.wulihub.com.cn/gc/Wez0VG/js/comments.js"></script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/utils.js"></script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/motion.js"></script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/next-boot.js"></script>

  
<script src="https://npm.elemecdn.com/hexo-generator-searchdb@1.4.0/dist/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/search/local-search.js"></script>





  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




<link rel="stylesheet" href="https://npm.elemecdn.com/disqusjs@1.3.0/dist/disqusjs.css" integrity="sha256-GxdCIOyfxQ1OBfS99qAIJDoGK1ADuBsxhMTqXG82fAY=" crossorigin="anonymous">

<script class="next-config" data-name="disqusjs" type="application/json">{"enable":true,"api":"https://duosuo.nobige.cn/","apikey":"Kmo9kPwsir7ppp8tGpeGROCmUtW8tdZBOdBVowPC67xVfTS5uV1wr6s4kckvP95m","shortname":"nobige","js":{"url":"https://npm.elemecdn.com/disqusjs@1.3.0/dist/disqus.js","integrity":"sha256-LVaMHPQ2zLqOc5rXSAfr4d1PIkEGNLyyUTDNPZmTtUw="}}</script>
<script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/comments/disqusjs.js"></script>

</body>
</html>
